import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '../views/login.vue'
import Main from '../views/main/index.vue'
import Home from '../views/main/home'
import OrderRoom from '../views/main/orderroom'
import MyOrder from '../views/main/myorder'
import OrderJingli from '../views/main/orderjingli'
import OrderManger from '../views/main/ordermanger'

Vue.use(VueRouter)

const routes = [
  {
    path: '/login',
    name: 'login',
    component: Login
  },
  {
    path: '/main',
    name: 'main',
    children:[
        {
            path:'/main/home',
            component:Home
        },
        {
            path:'/main/orderroom',
            component:OrderRoom
        },
        {
            path:'/main/myorder',
            component:MyOrder
        },
        {
            path:'/main/orderjingli',
            component:OrderJingli
        },
        {
            path:'/main/ordermanger',
            component:OrderManger
        },
        {
            path:'/main',
            redirect:'/main/home'
        }
    ],
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: Main
  },
  {
      path:'/',
      redirect:'/main'
  }
]

const router = new VueRouter({
    linkActiveClass:'active',
    routes
})

export default router
